Carbon


FSCreateFork

Header: Files.h Carbon status: Supported

Creates a named fork for a file or directory.

OSErr FSCreateFork (
    const FSRef *ref, 
    UniCharCount forkNameLength, 
    const UniChar *forkName
);
ref

A pointer to the file or directory.

forkNameLength

The length of the fork name (in Unicode characters). A newly created fork has zero length (i.e. its logical end-of-file is zero).

forkName

A pointer to the Unicode name of the fork to open.

function result

A result code. If the named fork already exists, errFSForkExists is returned. If the fork name is syntactically invalid or otherwise unsupported for the given volume, errFSBadForkName or errFSNameTooLong is returned.

DISCUSSION

The data and resource forks of a file are automatically created and deleted as needed (for compatibility with older APIs, and because they’re often handled specially). If a given fork always exists for a given volume format (such as data and resource forks for HFS and HFS Plus, or data forks for most other volume formats), an attempt to create that fork when a zero-length fork already exists should return noErr; if a non-empty fork already exists then errFSForkExists should be returned.

AVAILABILITY

Supported in Carbon. Available in Mac OS 9, and later when Carbon 1.0.2 or later is present.


© 2000 Apple Computer, Inc. — (Last Updated 5/8/2000)